const path = require('path')
const merge = require('webpack-merge')
const baseWebpackconfig = require('./webpack.base.conf')

module.exports = merge(baseWebpackconfig,{
    devtool: 'eval-source-map',
    output: {
        libraryTarget: 'umd',
        filename: '[name].js',
        path: path.resolve(__dirname, 'dist'),
        publicPath: '/'
    },
    devServer: {
        hot: true,
        open:true,
        port: 8032,
        headers: {
            'Access-Control-Allow-Origin': '*',
            'Access-Control-Allow-Headers': '*',
        },
        proxy: {
        },
        overlay:{
            errors:true
        },
        // 对webpack编译时只提示错误信息 屏蔽warning 等
        stats: 'errors-only',
        publicPath: `/`,
        clientLogLevel: 'none',
        before: app => {
            // app.get('/', (req, res, next) => {
            //     res.send(`http://${req.headers.host}/a.min.js`) //打包成umd js
            // })
        },
        historyApiFallback: {
            index: `/`
        }
    },
    watch:true,
    watchOptions: {
        aggregateTimeout: 600,
        poll: 1000
    }
})